package hevs.eServices.server;

import java.sql.Connection;
import java.sql.DriverManager;

public class MySQLConnection {

	private volatile static MySQLConnection uniqueInstance;
	
	private Connection conn = null;
	
//	private String url = "jdbc:mysql://localhost/eservice_v1";
//	private String user = "root";
//	private String pass = "";
	private String url = "jdbc:mysql://153.109.124.79/eservice_v1";
	private String user = "root";
	private String pass = "batsmart";

	private MySQLConnection() {
		try {
			Class.forName("com.mysql.jdbc.Driver").newInstance();
			conn = DriverManager.getConnection(url, user, pass);
		} catch (Exception e) {
			// empty
		}
	}
	
	public static synchronized MySQLConnection getInstance() {
		if(uniqueInstance == null) {
			synchronized(MySQLConnection.class) {
				if(uniqueInstance == null)
					uniqueInstance = new MySQLConnection();
			}
		}
		return uniqueInstance;
	}

	public Connection getConn() {
		return conn;
	}
	
}